package SinglePattern.HangleModel;

import SinglePattern.HangleModel.HangleModel;

/**
 * 饿汉模式
 *
 * @author
 * @create 2018-10-18 11:03
 **/
public class SinglePatternDemo1 {

    public static void main(String[] args) {
        //最基本的懒汉式
        HangleModel instance1 = HangleModel.getInstance();
        HangleModel instance2 = HangleModel.getInstance();

        if (instance1 == instance1) {
            System.out.println("我们是相同的对象");
        }
        instance1.sayHello();
        System.out.println("-------------------");
        System.out.println("标准的栏汉式");
        HangleModel1 instance3 = HangleModel1.getInstance();
        HangleModel1 instance4 = HangleModel1.getInstance();
        if (instance3 == instance4) {
            System.out.println("我们是相同的对象");
        }
        instance4.hangleMode1Hello();

    }
}
